package com.example.netty.io.core

import java.nio.charset.Charset
import java.util.concurrent.Executor
import java.util.concurrent.Executors


/**
 * File Name : NettyConfigure
 * Author : luqihua
 * Date : 2024/4/12
 * Desc : 全局配置Netty的参数
 **/

object NettyConfigure : ConfigureBuilder() {
    fun config(builder: ConfigureBuilder.() -> Unit) {
        this.apply(builder)
    }
}

open class ConfigureBuilder {
    var isDebug:Boolean = true
    var logLevel: Int = 3
    var delimiter:String = "###"
    var maxRetryCount = 5
    var charset: Charset = Charsets.UTF_8
    var soTimeOut = 5000
    var readIdleTime: Long = 5000
    var writeIdleTime: Long = readIdleTime
    var allIdleTime: Long = readIdleTime
    var executor: Executor = Executors.newCachedThreadPool()
}